/**************************************
 * File: GCInfo.cpp
 * Authors: Anders "Saasen" Stensaas
 *			Stig Magnus Halvorsen
 *			Peder Thorup
 * 
 * Description: Extracted from Osborne
 *				McGraw-Hill's gc.h
 *
 * Source:
 *	http://www.devarticles.com/c/a/Cplusplus/A-Simple-Garbage-Collector-for-C-plus-plus/3/
 *
 ************************************/

#include "GCInfo.h"

std::list<GCInfo> GCInfo::gclist; // gclist maintains the garbage collection list.
bool GCInfo::first; // true when first GCPtr is created

// Constructor
GCInfo::GCInfo(void *mPtr, unsigned size)
{
	refcount = 1;
	memPtr = mPtr;
	if(size != 0)
		isArray = true;
	else
		isArray = false;
	arraySize = size;
}

// Overloading operator== allows GCInfos to be compared.
// This is needed by the STL list class.
bool GCInfo::operator==(const GCInfo &obj) const
{
	return (obj.memPtr == this->memPtr);
}